package com.haozhiyan.zhijian.myDao;

import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;

import com.haozhiyan.zhijian.bean.LocalMediaListConvert;
import java.util.List;

import com.haozhiyan.zhijian.bean.xcjc.XCJCSaveBean;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "XCJCSAVE_BEAN".
*/
public class XCJCSaveBeanDao extends AbstractDao<XCJCSaveBean, String> {

    public static final String TABLENAME = "XCJCSAVE_BEAN";

    /**
     * Properties of entity XCJCSaveBean.<br/>
     * Can be used for QueryBuilder and for referencing column names.
    */
    public static class Properties {
        public final static Property TimeId = new Property(0, String.class, "timeId", true, "TIME_ID");
        public final static Property Local = new Property(1, String.class, "local", false, "LOCAL");
        public final static Property InspectionIds = new Property(2, String.class, "inspectionIds", false, "INSPECTION_IDS");
        public final static Property ParticularsName = new Property(3, String.class, "particularsName", false, "PARTICULARS_NAME");
        public final static Property ParticularsDesc = new Property(4, String.class, "particularsDesc", false, "PARTICULARS_DESC");
        public final static Property JianChaR = new Property(5, String.class, "JianChaR", false, "JIAN_CHA_R");
        public final static Property BatchId = new Property(6, String.class, "batchId", false, "BATCH_ID");
        public final static Property ProjectId = new Property(7, String.class, "projectId", false, "PROJECT_ID");
        public final static Property SectionId = new Property(8, String.class, "sectionId", false, "SECTION_ID");
        public final static Property Tower = new Property(9, String.class, "tower", false, "TOWER");
        public final static Property Unit = new Property(10, String.class, "unit", false, "UNIT");
        public final static Property Floor = new Property(11, String.class, "floor", false, "FLOOR");
        public final static Property Room = new Property(12, String.class, "room", false, "ROOM");
        public final static Property Housemap = new Property(13, String.class, "housemap", false, "HOUSEMAP");
        public final static Property ParticularsId = new Property(14, String.class, "particularsId", false, "PARTICULARS_ID");
        public final static Property Serious = new Property(15, String.class, "serious", false, "SERIOUS");
        public final static Property RectifyTimelimit = new Property(16, String.class, "rectifyTimelimit", false, "RECTIFY_TIMELIMIT");
        public final static Property Rectify = new Property(17, String.class, "rectify", false, "RECTIFY");
        public final static Property Review = new Property(18, String.class, "review", false, "REVIEW");
        public final static Property DutyUnit = new Property(19, String.class, "dutyUnit", false, "DUTY_UNIT");
        public final static Property CreateTime = new Property(20, String.class, "createTime", false, "CREATE_TIME");
        public final static Property TroubleChengDu = new Property(21, String.class, "troubleChengDu", false, "TROUBLE_CHENG_DU");
        public final static Property OrderOfSeverity = new Property(22, String.class, "orderOfSeverity", false, "ORDER_OF_SEVERITY");
        public final static Property Num = new Property(23, String.class, "num", false, "NUM");
        public final static Property RectifyName = new Property(24, String.class, "rectifyName", false, "RECTIFY_NAME");
        public final static Property DutyName = new Property(25, String.class, "dutyName", false, "DUTY_NAME");
        public final static Property ReviewName = new Property(26, String.class, "reviewName", false, "REVIEW_NAME");
        public final static Property CcName = new Property(27, String.class, "ccName", false, "CC_NAME");
        public final static Property Cc = new Property(28, String.class, "cc", false, "CC");
        public final static Property Pics = new Property(29, String.class, "pics", false, "PICS");
    };

    private final LocalMediaListConvert picsConverter = new LocalMediaListConvert();

    public XCJCSaveBeanDao(DaoConfig config) {
        super(config);
    }
    
    public XCJCSaveBeanDao(DaoConfig config, DaoSession daoSession) {
        super(config, daoSession);
    }

    /** Creates the underlying database table. */
    public static void createTable(Database db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE " + constraint + "\"XCJCSAVE_BEAN\" (" + //
                "\"TIME_ID\" TEXT PRIMARY KEY NOT NULL ," + // 0: timeId
                "\"LOCAL\" TEXT," + // 1: local
                "\"INSPECTION_IDS\" TEXT," + // 2: inspectionIds
                "\"PARTICULARS_NAME\" TEXT," + // 3: particularsName
                "\"PARTICULARS_DESC\" TEXT," + // 4: particularsDesc
                "\"JIAN_CHA_R\" TEXT," + // 5: JianChaR
                "\"BATCH_ID\" TEXT," + // 6: batchId
                "\"PROJECT_ID\" TEXT," + // 7: projectId
                "\"SECTION_ID\" TEXT," + // 8: sectionId
                "\"TOWER\" TEXT," + // 9: tower
                "\"UNIT\" TEXT," + // 10: unit
                "\"FLOOR\" TEXT," + // 11: floor
                "\"ROOM\" TEXT," + // 12: room
                "\"HOUSEMAP\" TEXT," + // 13: housemap
                "\"PARTICULARS_ID\" TEXT," + // 14: particularsId
                "\"SERIOUS\" TEXT," + // 15: serious
                "\"RECTIFY_TIMELIMIT\" TEXT," + // 16: rectifyTimelimit
                "\"RECTIFY\" TEXT," + // 17: rectify
                "\"REVIEW\" TEXT," + // 18: review
                "\"DUTY_UNIT\" TEXT," + // 19: dutyUnit
                "\"CREATE_TIME\" TEXT," + // 20: createTime
                "\"TROUBLE_CHENG_DU\" TEXT," + // 21: troubleChengDu
                "\"ORDER_OF_SEVERITY\" TEXT," + // 22: orderOfSeverity
                "\"NUM\" TEXT," + // 23: num
                "\"RECTIFY_NAME\" TEXT," + // 24: rectifyName
                "\"DUTY_NAME\" TEXT," + // 25: dutyName
                "\"REVIEW_NAME\" TEXT," + // 26: reviewName
                "\"CC_NAME\" TEXT," + // 27: ccName
                "\"CC\" TEXT," + // 28: cc
                "\"PICS\" TEXT);"); // 29: pics
        // Add Indexes
        db.execSQL("CREATE UNIQUE INDEX " + constraint + "IDX_XCJCSAVE_BEAN_TIME_ID ON XCJCSAVE_BEAN" +
                " (\"TIME_ID\" ASC);");
    }

    /** Drops the underlying database table. */
    public static void dropTable(Database db, boolean ifExists) {
        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"XCJCSAVE_BEAN\"";
        db.execSQL(sql);
    }

    @Override
    protected final void bindValues(DatabaseStatement stmt, XCJCSaveBean entity) {
        stmt.clearBindings();
 
        String timeId = entity.getTimeId();
        if (timeId != null) {
            stmt.bindString(1, timeId);
        }
 
        String local = entity.getLocal();
        if (local != null) {
            stmt.bindString(2, local);
        }
 
        String inspectionIds = entity.getInspectionIds();
        if (inspectionIds != null) {
            stmt.bindString(3, inspectionIds);
        }
 
        String particularsName = entity.getParticularsName();
        if (particularsName != null) {
            stmt.bindString(4, particularsName);
        }
 
        String particularsDesc = entity.getParticularsDesc();
        if (particularsDesc != null) {
            stmt.bindString(5, particularsDesc);
        }
 
        String JianChaR = entity.getJianChaR();
        if (JianChaR != null) {
            stmt.bindString(6, JianChaR);
        }
 
        String batchId = entity.getBatchId();
        if (batchId != null) {
            stmt.bindString(7, batchId);
        }
 
        String projectId = entity.getProjectId();
        if (projectId != null) {
            stmt.bindString(8, projectId);
        }
 
        String sectionId = entity.getSectionId();
        if (sectionId != null) {
            stmt.bindString(9, sectionId);
        }
 
        String tower = entity.getTower();
        if (tower != null) {
            stmt.bindString(10, tower);
        }
 
        String unit = entity.getUnit();
        if (unit != null) {
            stmt.bindString(11, unit);
        }
 
        String floor = entity.getFloor();
        if (floor != null) {
            stmt.bindString(12, floor);
        }
 
        String room = entity.getRoom();
        if (room != null) {
            stmt.bindString(13, room);
        }
 
        String housemap = entity.getHousemap();
        if (housemap != null) {
            stmt.bindString(14, housemap);
        }
 
        String particularsId = entity.getParticularsId();
        if (particularsId != null) {
            stmt.bindString(15, particularsId);
        }
 
        String serious = entity.getSerious();
        if (serious != null) {
            stmt.bindString(16, serious);
        }
 
        String rectifyTimelimit = entity.getRectifyTimelimit();
        if (rectifyTimelimit != null) {
            stmt.bindString(17, rectifyTimelimit);
        }
 
        String rectify = entity.getRectify();
        if (rectify != null) {
            stmt.bindString(18, rectify);
        }
 
        String review = entity.getReview();
        if (review != null) {
            stmt.bindString(19, review);
        }
 
        String dutyUnit = entity.getDutyUnit();
        if (dutyUnit != null) {
            stmt.bindString(20, dutyUnit);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(21, createTime);
        }
 
        String troubleChengDu = entity.getTroubleChengDu();
        if (troubleChengDu != null) {
            stmt.bindString(22, troubleChengDu);
        }
 
        String orderOfSeverity = entity.getOrderOfSeverity();
        if (orderOfSeverity != null) {
            stmt.bindString(23, orderOfSeverity);
        }
 
        String num = entity.getNum();
        if (num != null) {
            stmt.bindString(24, num);
        }
 
        String rectifyName = entity.getRectifyName();
        if (rectifyName != null) {
            stmt.bindString(25, rectifyName);
        }
 
        String dutyName = entity.getDutyName();
        if (dutyName != null) {
            stmt.bindString(26, dutyName);
        }
 
        String reviewName = entity.getReviewName();
        if (reviewName != null) {
            stmt.bindString(27, reviewName);
        }
 
        String ccName = entity.getCcName();
        if (ccName != null) {
            stmt.bindString(28, ccName);
        }
 
        String cc = entity.getCc();
        if (cc != null) {
            stmt.bindString(29, cc);
        }
 
        List pics = entity.getPics();
        if (pics != null) {
            stmt.bindString(30, picsConverter.convertToDatabaseValue(pics));
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, XCJCSaveBean entity) {
        stmt.clearBindings();
 
        String timeId = entity.getTimeId();
        if (timeId != null) {
            stmt.bindString(1, timeId);
        }
 
        String local = entity.getLocal();
        if (local != null) {
            stmt.bindString(2, local);
        }
 
        String inspectionIds = entity.getInspectionIds();
        if (inspectionIds != null) {
            stmt.bindString(3, inspectionIds);
        }
 
        String particularsName = entity.getParticularsName();
        if (particularsName != null) {
            stmt.bindString(4, particularsName);
        }
 
        String particularsDesc = entity.getParticularsDesc();
        if (particularsDesc != null) {
            stmt.bindString(5, particularsDesc);
        }
 
        String JianChaR = entity.getJianChaR();
        if (JianChaR != null) {
            stmt.bindString(6, JianChaR);
        }
 
        String batchId = entity.getBatchId();
        if (batchId != null) {
            stmt.bindString(7, batchId);
        }
 
        String projectId = entity.getProjectId();
        if (projectId != null) {
            stmt.bindString(8, projectId);
        }
 
        String sectionId = entity.getSectionId();
        if (sectionId != null) {
            stmt.bindString(9, sectionId);
        }
 
        String tower = entity.getTower();
        if (tower != null) {
            stmt.bindString(10, tower);
        }
 
        String unit = entity.getUnit();
        if (unit != null) {
            stmt.bindString(11, unit);
        }
 
        String floor = entity.getFloor();
        if (floor != null) {
            stmt.bindString(12, floor);
        }
 
        String room = entity.getRoom();
        if (room != null) {
            stmt.bindString(13, room);
        }
 
        String housemap = entity.getHousemap();
        if (housemap != null) {
            stmt.bindString(14, housemap);
        }
 
        String particularsId = entity.getParticularsId();
        if (particularsId != null) {
            stmt.bindString(15, particularsId);
        }
 
        String serious = entity.getSerious();
        if (serious != null) {
            stmt.bindString(16, serious);
        }
 
        String rectifyTimelimit = entity.getRectifyTimelimit();
        if (rectifyTimelimit != null) {
            stmt.bindString(17, rectifyTimelimit);
        }
 
        String rectify = entity.getRectify();
        if (rectify != null) {
            stmt.bindString(18, rectify);
        }
 
        String review = entity.getReview();
        if (review != null) {
            stmt.bindString(19, review);
        }
 
        String dutyUnit = entity.getDutyUnit();
        if (dutyUnit != null) {
            stmt.bindString(20, dutyUnit);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(21, createTime);
        }
 
        String troubleChengDu = entity.getTroubleChengDu();
        if (troubleChengDu != null) {
            stmt.bindString(22, troubleChengDu);
        }
 
        String orderOfSeverity = entity.getOrderOfSeverity();
        if (orderOfSeverity != null) {
            stmt.bindString(23, orderOfSeverity);
        }
 
        String num = entity.getNum();
        if (num != null) {
            stmt.bindString(24, num);
        }
 
        String rectifyName = entity.getRectifyName();
        if (rectifyName != null) {
            stmt.bindString(25, rectifyName);
        }
 
        String dutyName = entity.getDutyName();
        if (dutyName != null) {
            stmt.bindString(26, dutyName);
        }
 
        String reviewName = entity.getReviewName();
        if (reviewName != null) {
            stmt.bindString(27, reviewName);
        }
 
        String ccName = entity.getCcName();
        if (ccName != null) {
            stmt.bindString(28, ccName);
        }
 
        String cc = entity.getCc();
        if (cc != null) {
            stmt.bindString(29, cc);
        }
 
        List pics = entity.getPics();
        if (pics != null) {
            stmt.bindString(30, picsConverter.convertToDatabaseValue(pics));
        }
    }

    @Override
    public String readKey(Cursor cursor, int offset) {
        return cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0);
    }    

    @Override
    public XCJCSaveBean readEntity(Cursor cursor, int offset) {
        XCJCSaveBean entity = new XCJCSaveBean( //
            cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // timeId
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // local
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // inspectionIds
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // particularsName
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // particularsDesc
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // JianChaR
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // batchId
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // projectId
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // sectionId
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // tower
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // unit
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // floor
            cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // room
            cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // housemap
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // particularsId
            cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // serious
            cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // rectifyTimelimit
            cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // rectify
            cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // review
            cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // dutyUnit
            cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // createTime
            cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // troubleChengDu
            cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // orderOfSeverity
            cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // num
            cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // rectifyName
            cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // dutyName
            cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // reviewName
            cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // ccName
            cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // cc
            cursor.isNull(offset + 29) ? null : picsConverter.convertToEntityProperty(cursor.getString(offset + 29)) // pics
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, XCJCSaveBean entity, int offset) {
        entity.setTimeId(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
        entity.setLocal(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setInspectionIds(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setParticularsName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setParticularsDesc(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setJianChaR(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setBatchId(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setProjectId(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setSectionId(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setTower(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setUnit(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setFloor(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setRoom(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
        entity.setHousemap(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13));
        entity.setParticularsId(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setSerious(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
        entity.setRectifyTimelimit(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
        entity.setRectify(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
        entity.setReview(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
        entity.setDutyUnit(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
        entity.setCreateTime(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20));
        entity.setTroubleChengDu(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21));
        entity.setOrderOfSeverity(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22));
        entity.setNum(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23));
        entity.setRectifyName(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24));
        entity.setDutyName(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25));
        entity.setReviewName(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26));
        entity.setCcName(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27));
        entity.setCc(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28));
        entity.setPics(cursor.isNull(offset + 29) ? null : picsConverter.convertToEntityProperty(cursor.getString(offset + 29)));
     }
    
    @Override
    protected final String updateKeyAfterInsert(XCJCSaveBean entity, long rowId) {
        return entity.getTimeId();
    }
    
    @Override
    public String getKey(XCJCSaveBean entity) {
        if(entity != null) {
            return entity.getTimeId();
        } else {
            return null;
        }
    }

    @Override
    protected final boolean isEntityUpdateable() {
        return true;
    }
    
}
